import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';

class SocialMedia extends StatefulWidget {
  const SocialMedia({Key? key}) : super(key: key);

  @override
  State<SocialMedia> createState() => _SocialMediaState();
}

class _SocialMediaState extends State<SocialMedia> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        IconHolder(icon: AntDesign.twitter),
        IconHolder(icon: AntDesign.facebook_square),
        IconHolder(icon: AntDesign.youtube),
      ],
    );
  }
}

class IconHolder extends StatefulWidget {
  final IconData? icon;

  const IconHolder({Key? key, this.icon}) : super(key: key);

  @override
  State<IconHolder> createState() => _IconHolderState();
}

class _IconHolderState extends State<IconHolder> {
  Color? color;

  @override
  void initState() {
    super.initState();
    color = Colors.white;
  }

  @override
  Widget build(BuildContext context) {
    return MouseRegion(
      onEnter: (event) {
        setState(() {
          color = Colors.black;
        });
      },
      onExit: (event) {
        setState(() {
          color = Colors.white;
        });
      },
      child: Container(
        padding: EdgeInsets.all(15.0),
        child: Icon(
          widget.icon!,
          size: 26.0,
          color: color,
        ),
      ),
    );
  }
}
